﻿/*----------------------------------------------------------------------------------------
*
*  Copyright 2019, Gao Hai Hui, <fromzeropoint@126.com>.  All rights reserved.
*  https://gitee.com/helloworldghh/xoskit.git
*  Use of this source code is governed by a MIT license
*  that can be found in the License file.
*
----------------------------------------------------------------------------------------*/
#ifndef __XOSKIT_XOS_CORE_XOS_STL_SRC_PROTOCOL_PUBLIC_SSL_H__
#define __XOSKIT_XOS_CORE_XOS_STL_SRC_PROTOCOL_PUBLIC_SSL_H__

#include "public_base.h"

namespace xos_protocol
{

	class public_ssl : public public_base
	{
    public:
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // 
        typedef public_base BASE;

	public:
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // 
		public_ssl( xos_box::i_serial * pSerial, xos_box::i_buf * pBuf ) :
            BASE( pSerial, pBuf )
        {
        }
		~public_ssl()
        {
        };

	public:
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // 
		int req_compose( int nCookie, int nCmd, const char * lpszEncPass, int nSize )
		{
			int ret = 0;
            if( 0 == ret )
            {
                ret = BASE::req_compose( nCookie, nCmd );
            }
			if( 0 == ret )
			{
				ret = BASE::pack_mem( lpszEncPass, nSize );
			}
			return ret;
		}
		int req_dis_compose( char * lpszEncPass, int nSize, int * lpnSize )
		{
			int ret = 0;
            if( 0 == ret )
            {
                ret = BASE::req_dis_compose();
            }
			if( 0 == ret )
			{
				ret = BASE::un_pack_mem( lpszEncPass, nSize, lpnSize, 0 );
			}
			return ret;
		}

        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // 
		int res_compose( int nCookie, int nCmd )
		{
			int ret = 0;
            if( 0 == ret )
            {
                ret = BASE::res_compose( nCookie, nCmd, 0 );
            }
			return ret;
		}
		int res_dis_compose()
		{
            int nRet = 0;
			int ret = 0;
            if( 0 == ret )
            {
                ret = BASE::res_dis_compose( nRet );
            }
			return ret;
		}
	};

}

#endif // __XOSKIT_XOS_CORE_XOS_STL_SRC_PROTOCOL_PUBLIC_SSL_H__
